var vm = new Vue({
    el: '#content', //el指定一个页面中已存在的DOM元素来挂载VUE实例
    data: {
        loginForm: {
            isfree:false
        },
    },
    created: function () {
        localStorage.removeItem("userInfo");
        sessionStorage.removeItem("userInfo");
    },
    methods: {
        login: function () {
            console.log(this.loginForm);
            console.log("进入了vue模型");
            axios.request({
                url: `/user/login/${this.loginForm.yzm}`,
                method: "post",
                headers: {
                    'Content-Type': 'application/json' //重点
                },
                data: this.loginForm
            }).then(res => {
                if (res.data.code == 20000) {
                    window.location.href = "/view/home";
                    localStorage.setItem("userInfo", JSON.stringify(res.data));
                    localStorage.setItem("userName", JSON.stringify(res.data.data.username));
                    localStorage.setItem("userId", JSON.stringify(res.data.data.id));
                    console.log(res.data)
                } else {
                    layer.msg("身份信息错误，请检查")
                }
            });
        },
        freeOfsevenDay(){
            console.log(this.loginForm.isfree)
        },
        //微信登陆
        weixinLogin:function () {
            axios.request({
                url:`/user/loginByWechat`,
                method: 'get'
            }).then(res=>{
                window.location.href=res.data.data;
            })
        },



    }
});